package bosVM2.Engine;

import bosVM2.meta.Objects.BosClass;
import bosVM2.meta.Objects.BosObject;
import bosVM2.util.Map;

public class Heap {
	
	private static Heap H = new Heap();
	private Heap() { };
	public static Heap getH() { return H;}
	
	private Map<Integer, BosObject> map = new Map<Integer,BosObject>();
	
	public Integer Allocate(BosClass c)
	{
		BosObject o = new BosObject(c);
		Integer addr = map.size();
		map.put(addr, o);
		return addr;
	}
	
	public BosObject get(int ref)
	{
		return map.get(ref);
	}
	
	public String toString()
	{
		return map.size() + "";
	}
}


